function allMobile(){
	$("html").css("font-size", $(window).width() * 0.03125 + "px");
	$(window).resize(function(){
		$("html").css("font-size", $(window).width() * 0.03125 + "px");
	})
}

function head(){
	$(".head .menuIcon").click(function(){
		$(this).toggleClass("cur").siblings(".right").stop(true).slideToggle(300)
	})
	if($(window).width()>768){
		var $li = $(".head .right .bot .bL ul li");
		$.each($li,function(index){
			$(this).hover(function(){
				var liW = $(this).width();
				var pW = $(this).find("p").width();
				$(this).find("p").css({
					'margin-left': - pW / 2 + liW / 2
					// 'margin-left': - pW / 2 
				})
			})
		})
	}
}

function rightIcon(){
	if($(window).width()>1335){
		$(window).scroll(function(){
			if($(window).scrollTop() > 200){
				$(".rightFixed").fadeIn(300);
			}else {
				$(".rightFixed").fadeOut(300);
			}
		})
	}
	$(".rightFixed ul li.goTop").click(function(){
		$("html,body").animate({
			scrollTop: 0,
		},1000)
	})
}

function allTitle(){
	var titSwiper = new Swiper(".titSwiper",{
		slidesPerView: 'auto',
	})
}

function indexBanner(){
	var bannerSwiper = new Swiper(".bannerSwiper",{
		speed: 1500,
		pagination: '.bannerPagi',
		autoplay: 2000,
		autoplayDisableOnInteraction: false,
		loop: true,
		prevButton: '.bannerPrev',
		nextButton: '.bannerNext',
	})
}

function index(){
	var topSwiper = new Swiper(".topSwiper",{
		// loop: true,
		// autoplay: 3500,
		slidesPerView: 4,
		spaceBetween: 5 + '%',
		prevButton: '.topPrev',
		nextButton: '.topNext',
		breakpoints: {
			600: {
				slidesPerView: 2,
			},
			380: {
				slidesPerView: 1,
			}
		}
	})
	var botSwiper = new Swiper(".botSwiper",{
		// loop: true,
		// autoplay: 3500,
		slidesPerView: 3,
		spaceBetween: 2 + '%',
		prevButton: '.botPrev',
		nextButton: '.botNext',
		breakpoints: {
			600: {
				slidesPerView: 2,
			},
			380: {
				slidesPerView: 1,
			}
		}
	})
}

function culture(){
	var culSwiper = new Swiper(".culSwiper",{
		loop: true,
		autoplay: 3500,
		slidesPerView: 3,
		spaceBetween: 2+ '%',
		prevButton: '.culPrev',
		nextButton: '.culNext',
		breakpoints: {
			600: {
				slidesPerView: 2,
			},
			380: {
				slidesPerView: 1,
			}
		}
	})
}

function honor(){
	var hoSwiper1 = new Swiper(".hoSwiper1",{
		loop: true,
		autoplay: 3500,
		slidesPerView: 3,
		spaceBetween: 6+ '%',
		prevButton: '.hoPrev1',
		nextButton: '.hoNext1',
		breakpoints: {
			600: {
				slidesPerView: 2,
			},
			380: {
				slidesPerView: 1,
			}
		}
	})
	var hoSwiper2 = new Swiper(".hoSwiper2",{
		loop: true,
		autoplay: 3500,
		slidesPerView: 5,
		spaceBetween: 6+ '%',
		prevButton: '.hoPrev2',
		nextButton: '.hoNext2',
		breakpoints: {
			600: {
				slidesPerView: 3,
			},
			380: {
				slidesPerView: 2,
			}
		}
	})
}

function allLeft(){
	if($(window).width()<769){
		var leftSwiper = new Swiper(".leftSwiper",{
			slidesPerView: 'auto',
		})
	}
}

function products(){
	var ptSwiper = new Swiper(".ptSwiper",{
		slidesPerView: 2,
		spaceBetween: 4 + '%',
		pagination: '.ptPagi',
		autoplayDisableOnInteraction : false,
		paginationClickable :true,
		prevButton: '.ptPrev',
		nextButton: '.ptNext',
	})
}

function switchs(objClick,objNav){
	var sClick = $(objClick),
		sNav = $(objNav);
	sClick.eq(0).addClass("cur");
	sNav.eq(0).show();
	$.each(sClick,function(index){
		$(this).click(function(){
			$(this).addClass("cur").siblings().removeClass("cur");
			sNav.hide().eq(index).stop(true,true).fadeIn(300);
		})
	})
}

function culPop(){
	// $(".page2 .cen .swiper-slide").click(function(){
	// 	var imgH = $(".page2 .cen .swiper-slide a img")[0].src();
	// 	$(".culPop .nav img")[0].attr('src',imgH);
	// })

	$(".page2 .cen .swiper-slide").click(function(){
		var imgSrc = $(this).find("img")[0].src;
		$(".culPop").fadeIn(300);
		$(".culPop .nav img").attr('src',imgSrc);
	});
	$(".culPop .popBg,.culPop .nav").click(function(){
		$(".culPop").fadeOut(300);
	})
}

function proDetail(){
	// var deSwiperT = new Swiper(".deSwiperT",{

	// })

	var deSwiperB = new Swiper(".deSwiperB",{
		slidesPerView: 4,
		prevButton: '.dePrevB',
		nextButton: '.deNextB',
	})
}


$(function(){
	allMobile();
	head();
	rightIcon();
	allTitle();
	allLeft();
});